package com.cy.lib.util;

import android.content.Context;

/**
 * @author CY
 * @title
 * @date 2015/6/23
 * @qq 568305883
 * @email tmxdyf@163.com
 */
public class ViewUtils {

    public static int dip2px(Context context, float dipValue) {
        float scale = context.getResources().getDisplayMetrics().density;
        return (int) (dipValue * scale + 0.5F);
    }

    public static int px2dip(Context context, float pxValue) {
        float scale = context.getResources().getDisplayMetrics().density;
        return (int) (pxValue / scale + 0.5F);
    }
}
